package com.example.spinnertest;

import java.util.ArrayList;
import java.util.List;

import android.app.Activity;
import android.app.AlertDialog;
import android.content.DialogInterface;
import android.os.Bundle;
import android.view.LayoutInflater;
import android.view.View;
import android.view.View.OnClickListener;
import android.widget.Button;
import android.widget.ImageView;
import android.widget.LinearLayout;
import android.widget.RelativeLayout;
import android.widget.TextView;

import com.example.spinnertest.tools.ListDialogAdapter;
import com.example.spinnertest.tools.SpinnerPopWindow;
import com.example.spinnertest.tools.SpinnerPopWindow.IOnItemSelectListener;
import com.example.spinnertest.tools.ViewGroupTest;
import com.example.spinnertest.tools.WXTDialog;

public class MainActivity extends Activity  implements OnClickListener{
	SpinnerPopWindow spinnerCountry;
	public  String province = "山东";
	RelativeLayout reLayout = null;
	TextView proTv = null;
	ImageView proImg = null;
	String []country;
	WXTDialog dialog = null;
	//TextView,Button
	Button button ;
//	ViewGroupTest viewGroup ;
//	View tvViewGroupItem ,reViewGroupItem;
	
	

	@Override
	protected void onCreate(Bundle savedInstanceState) {
		super.onCreate(savedInstanceState);
		setContentView( R.layout.button_layout);
		dialog= new WXTDialog(this);
		button = (Button) findViewById(R.id.button1);
		button.setOnClickListener(this);
		//viewGroup = (ViewGroupTest) findViewById(R.id.myviewgroup);

		//获取“country”和RelativiLayout控件
		//reViewGroupItem =  LayoutInflater.from(this).inflate(R.layout.viewgroup_item_relativelayout, null);

		//viewGroup.addView(reViewGroupItem);

		//initial();
	}


	public void initial()
	{
//		reLayout = (RelativeLayout) findViewById(R.id.spinnerRelativeLayout);
//		proTv = (TextView) findViewById(R.id.provinceTextView);
//		proTv.setText(province);
//		setUpCountry();
		
	}

	public void setUpCountry()
	{

	}

	//设置显示样式
	public void setCountry(int position)
	{
		proTv.setText(country[position]);
		province = country[position];
		
	}
	
	
	@Override
	protected void onResume() {
		// TODO Auto-generated method stub
		super.onResume();
		System.out.println("on resume....................");
	}
	
	@Override
	protected void onStart() {
		// TODO Auto-generated method stub
		super.onStart();
		System.out.println("on start......................");
	}
	
	@Override
	protected void onStop() {
		// TODO Auto-generated method stub
		super.onStop();
		System.out.println("on Stop..............");
	}
	
	
	//设置reLayout处下拉
	public void showCountry()
	{
		spinnerCountry.setWidth(reLayout.getWidth());
		spinnerCountry.showAsDropDown(reLayout);
	}

	@Override
	public void onClick(View v) {
		// TODO Auto-generated method stub
		switch (v.getId()) {
		case R.id.button1:
//			showCountry();
			dialog.show();
			break;
		
			
		}

	}


}
